package controllers

import "http_monitor/models"

type SettingsController struct {
	BaseController
}

func (c *SettingsController) Get() {
	c.Data["ViewName"] = "接口管理"

	settings := models.Settings{Id: 1}
	if err := settings.GetById(); err == nil {

	}

	c.Data["models"] = settings
	c.TplName = "settings/show.tpl"
}
func (c *SettingsController) Post() {
	c.Data["ViewName"] = "接口管理"

	settings := models.Settings{Id: 1}
	msg := "保存失败"
	if err := c.ParseForm(&settings); err == nil {
		if err := settings.UpdateApisById(); err == nil {
			msg = "保存成功"
		}

	}
	c.Data["msg"] = msg
	c.Data["models"] = settings
	c.TplName = "settings/show.tpl"
}
